﻿using FluentNHibernate.Mapping;
using Shake.Domain.Emuns;
using Shake.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shake.Domain.Maps
{
    public class CertificateMap : ClassMap<Certificate>
    {
        public CertificateMap()
        {
            this.Table("Certificate");
            this.Id(t => t.Id).Column("Id").Length(32).Not.Nullable();
            this.Map(t => t.Number).Column("Number").Not.Nullable();

            this.Map(t => t.ValidityStartTime).Column("ValidityStartTime").Not.Nullable();
            this.Map(t => t.ValidityEndTime).Column("ValidityEndTime").Not.Nullable();

            this.Map(t => t.Type).Column("Type").Not.Nullable().CustomType<GenericEnumMapper<CertificateType>>();
            this.Map(t => t.UserId).Column("UserId").Length(32).Not.Nullable();
            this.Map(t => t.Other).Column("Other");
        }
    }
}
